//
//  TzydmsVC+UI.swift
//  Auscultation
//
//  Created by 来 on 2020/12/10.
//

import Foundation

extension TzydmsVC {
    
    func initUI() {
        
        let top_view = UIImageView.init(image: #imageLiteral(resourceName: "beijing2@1.5x"))
        top_view.isUserInteractionEnabled = true
        view.addSubview(top_view)
        top_view.snp.makeConstraints { (make) in
            make.top.left.right.equalToSuperview()
            make.height.equalTo(UIDevice.lgf_NavBarH() + 80)
        }
        self.navTitle = "听诊引导模式"
        self.lgf_NavigationBar.lgf_Title?.textColor = UIColor.white
        self.lgf_NavigationBar.lgf_line?.isHidden = true
        
        let image_view2 = UIImageView.init(image: #imageLiteral(resourceName: "shebei@1.5x"))
        top_view.addSubview(image_view2)
        image_view2.snp.makeConstraints { (make) in
            make.left.equalToSuperview().offset(20)
            make.width.height.equalTo(18)
            make.centerY.equalToSuperview().multipliedBy(1.6)
        }
        
        let label1 = UILabel.init()
        label1.text = "设备编号："
        label1.textColor = UIColor.white
        label1.font = UIFont.boldSystemFont(ofSize: 15)
        top_view.addSubview(label1)
        label1.snp.makeConstraints { (make) in
            make.left.equalTo(image_view2.snp.right).offset(5)
            make.centerY.equalTo(image_view2)
            make.width.equalTo(80)
        }
        
        sbbh = UILabel.init()
        sbbh.text = EWEBluetooth.lgf.selectPeripheral?.identifier.uuidString ?? "未知"
        sbbh.textColor = UIColor.white
        sbbh.numberOfLines = 1
        sbbh.lgf_AddShowAllText()
        sbbh.font = UIFont.boldSystemFont(ofSize: 15)
        top_view.addSubview(sbbh)
        sbbh.snp.makeConstraints { (make) in
            make.left.equalTo(label1.snp.right)
            make.centerY.equalTo(image_view2)
            make.width.equalTo(150)
        }
        
        onLine = UILabel.init()
        onLine.text = "在线"
        onLine.textColor = UIColor.green
        onLine.font = UIFont.boldSystemFont(ofSize: 15)
        top_view.addSubview(onLine)
        onLine.snp.makeConstraints { (make) in
            make.right.equalToSuperview().offset(-20)
            make.centerY.equalTo(image_view2)
        }
        
        onOff = UIView.init()
        onOff.backgroundColor = UIColor.green
        onOff.layer.cornerRadius = 5
        top_view.addSubview(onOff)
        onOff.snp.makeConstraints { (make) in
            make.width.height.equalTo(10)
            make.right.equalTo(onLine.snp.left).offset(-5)
            make.centerY.equalTo(image_view2)
        }
        
        let image_view1 = UIImageView.init(image: #imageLiteral(resourceName: "heartArea"))
        view.addSubview(image_view1)
        image_view1.snp.makeConstraints { (make) in
            make.top.equalTo(top_view.snp.bottom).offset(40)
            make.width.equalToSuperview().offset(-30)
            make.height.equalTo(210)
            make.centerX.equalToSuperview()
        }
        
        let tzqy = UILabel.init()
        tzqy.text = "引导模式开始"
        tzqy.font = UIFont.systemFont(ofSize: 19)
        tzqy.textColor = UIColor.init(lgf_HexString: "222222")
        view.addSubview(tzqy)
        tzqy.snp.makeConstraints { (make) in
            make.top.equalTo(image_view1.snp.bottom).offset(40)
            make.centerX.equalToSuperview()
        }
        
        let bottom_view = UIView.init()
        view.addSubview(bottom_view)
        bottom_view.snp.makeConstraints { (make) in
            make.top.equalTo(tzqy.snp.bottom).offset(40)
            make.centerX.width.equalToSuperview()
            make.height.equalTo(100)
        }
        
        let button1 = UIButton.init(type: .custom)
        button1.backgroundColor = UIColor.init(lgf_HexString: EWEDarkMode.c_0F88F2)!
        button1.setTitle("开始引导", for: .normal)
        button1.setTitleColor(EWEDarkMode.white(), for: .normal)
        button1.titleLabel?.font = UIFont.systemFont(ofSize: 15)
        button1.layer.cornerRadius = 4
        button1.layer.masksToBounds = true
        button1.addTarget(self, action: #selector(TzydmsVC.ksyd(_:)), for: .touchUpInside)
        bottom_view.addSubview(button1)
        button1.snp.makeConstraints { (make) in
            make.center.equalToSuperview()
            make.width.equalToSuperview().offset(-75)
            make.height.equalTo(50)
        }
    }
    
}
